<?php 
include('../common/common.php');
include('../common/checksession.php');
checksession("../index.php");
include('../../inc/conn.php');

$del_id=$_GET["aid"];
$gurl=$_SERVER['HTTP_REFERER'];

isnum($del_id,"文档错误","../moduls/arcback_list.php");
if(!strstr($gurl,"arcback_list.php")){
	ShowMsg_h("操作失败!","../moduls/arcback_list.php");
	exit;
}

$db=db_connect();//连接数据库
$db->query('SET AUTOCOMMIT=0'); // 设置为不自动提交查询 
$db->query('START TRANSACTION'); // 开始查询，这里也可以使用BEG

$sql_main="DELETE FROM `".PRETABLE."arcmain` WHERE `id`='".$del_id."'";
$sql_arc="DELETE FROM `".PRETABLE."article` WHERE `aid`='".$del_id."'";

if(!$db->query($sql_main)){
	ShowMsg("操作失败！",$gurl);
	exit;
	}
$db->query($sql_arc);


if($db->affected_rows<0){
	$db->query('ROLLBACK');//如果遇到错误数据回滚
	ShowMsg("操作失败1!",$gurl);	
	$db->query('COMMIT');
	$db->close();
	exit;
}
$db->query('COMMIT');
$db->close();

ShowMsg_h("操作成功!",$gurl);	
?>